# Contributor: Carlo Landmeter <clandmeter@gmail.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=gross
pkgver=1.0.2
pkgrel=11
pkgdesc="Greylisting of suspicious sources"
url="http://code.google.com/p/gross/"
arch="all"
license="BSD"
depends=
makedepends="c-ares-dev autoconf automake libtool sed"
install="$pkgname.pre-install $pkgname.pre-upgrade
	$pkgname.post-upgrade"
subpackages="$pkgname-doc $pkgname-dev"
source="https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/gross/gross-$pkgver.tar.gz
	grossd.initd
	grossd.confd
	gross-1.0.1-default-conf.patch
	gross-grey_tuple.patch
	fix-shadow-declaration.patch"

_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
	local i
	cd "$_builddir"
	update_config_sub || return 1
	for i in $source; do
		case $i in
		*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
		esac
	done
}


build() {
	cd "$_builddir"
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--sysconfdir=/etc \
		--mandir=/usr/share/man \
		--infodir=/usr/share/info \
		|| return 1

	make -j1 || return 1
}

package() {
	cd "$_builddir"

	make -j1 DESTDIR="$pkgdir" install

	install -dD "$pkgdir"/var/run/gross
	install -m755 -D "$srcdir"/grossd.initd "$pkgdir"/etc/init.d/grossd
	install -m644 -D "$srcdir"/grossd.confd "$pkgdir"/etc/conf.d/grossd
}

sha512sums="fefeef9ec37747c7cbab8323aa4761e36352641bf314fd8fd98ac4e4d5890c5cf7c0858207d7d35a197cc0cad645a12e22b356575dd5f2c4eb4eac033636a2d2  gross-1.0.2.tar.gz
8784cd056372dced708b561548f71f24177b302efe2256626a6bb9b91374ae783be1c4d844b6f38af4b03f370b0c8c803ab9ce2f07855e630f98b585e0f65dc9  grossd.initd
d9f8b74d13e0d3f0e2dfe20e1b7a6e50e91e81c9769d3e1afe3370edf66da5827d3b24f369216370f426a0a242a797a470408831b2cf4e880d4f17d1611a065d  grossd.confd
90d80c1a68f71f671c19187dccaee9d475d92925a947d25e68c277b0c52f43e0e4b37c1d8f063a2ef155daa93d8f60fc19e3692f0193a9662670d47e425f37d4  gross-1.0.1-default-conf.patch
5561d46da4848b56d9bb38aa857fe584d7c35a0c432005430b25a2280ca320c70ae8a92bb2718243198345d2919d8eb3d04fb24056c404a648a17a9a6b564c94  gross-grey_tuple.patch
2a66db84af5d26291eaddb287bce1dddaa461f30792637b6efcebeb3c45f1e72e5f8beb0837bc4a5ddd330c59d4f2db4a58e5cd398164ad6481db27817f1ad15  fix-shadow-declaration.patch"
